from peewee import *
from decimal import Decimal
from engine.utility import MysqlPeeweeUtility
# 自定义字段类，用于将decimal自动转换为float


database = MySQLDatabase('amdc', **{'charset': 'utf8', 'sql_mode': 'PIPES_AS_CONCAT', 'use_unicode': True, 'host': 'localhost', 'port': 3306, 'user': 'root', 'password': 'xuyifan63'})

class DecimalFloatField(DecimalField):
    def python_value(self, value):
        if value is not None:
            if isinstance(value, Decimal):
                return float(value)
        return value

dbpool = MysqlPeeweeUtility('mysql').db
class UnknownField(object):
    def __init__(self, *_, **__): pass

class BaseModel(Model):
    class Meta:
        database = database

class Factors(BaseModel):
    factor_name = CharField(index=True)
    factor_value = FloatField(null=True)
    tradingcode = CharField()
    tradingday = DateTimeField(index=True)

    class Meta:
        table_name = 'factors'
        indexes = (
            (('tradingday', 'factor_name'), False),
            (('tradingday', 'tradingcode'), False),
        )
        primary_key = False

class InInfIdpBndInfoDi(BaseModel):
    accrueddate = DateTimeField(column_name='ACCRUEDDATE', null=True)
    accruedinterestfinal = DecimalFloatField(column_name='ACCRUEDINTERESTFINAL', null=True)
    basispointval = DecimalFloatField(column_name='BASISPOINTVAL', null=True)
    bondmaturity = DecimalFloatField(column_name='BONDMATURITY', null=True)
    bond_change = DecimalFloatField(column_name='BOND_CHANGE', null=True)
    bond_change_date = DateTimeField(column_name='BOND_CHANGE_DATE', null=True)
    categorycode = DecimalFloatField(column_name='CATEGORYCODE', null=True)
    categorycodei = CharField(column_name='CATEGORYCODEI', null=True)
    categorycodeii = CharField(column_name='CATEGORYCODEII', null=True)
    categorydesc = CharField(column_name='CATEGORYDESC', null=True)
    categorynamei = CharField(column_name='CATEGORYNAMEI', null=True)
    categorynameii = CharField(column_name='CATEGORYNAMEII', null=True)
    cert_num = CharField(column_name='CERT_NUM', null=True)
    cert_type = CharField(column_name='CERT_TYPE', null=True)
    changedate = DateTimeField(column_name='CHANGEDATE', null=True)
    changesumafter = DecimalFloatField(column_name='CHANGESUMAFTER', null=True)
    change_date = DateTimeField(column_name='CHANGE_DATE', null=True)
    chiname = CharField(column_name='CHINAME', null=True)
    chispelling = CharField(column_name='CHISPELLING', null=True)
    citycode = DecimalFloatField(column_name='CITYCODE', null=True)
    cityname = CharField(column_name='CITYNAME', null=True)
    comcode = BigIntegerField(column_name='COMCODE', index=True)
    comnaturecode = CharField(column_name='COMNATURECODE', null=True)
    comratingdate = DateTimeField(column_name='COMRATINGDATE', null=True)
    com_change = DecimalFloatField(column_name='COM_CHANGE', null=True)
    com_creditrating = CharField(column_name='COM_CREDITRATING', null=True)
    convexity = DecimalFloatField(column_name='CONVEXITY', null=True)
    countrycode = DecimalFloatField(column_name='COUNTRYCODE', null=True)
    countryname = CharField(column_name='COUNTRYNAME', null=True)
    creditorcode = DecimalFloatField(column_name='CREDITORCODE', null=True)
    creditorname = CharField(column_name='CREDITORNAME', null=True)
    creditrating = CharField(column_name='CREDITRATING', null=True)
    creditview = DecimalFloatField(column_name='CREDITVIEW', null=True)
    creditviewdesc = CharField(column_name='CREDITVIEWDESC', null=True)
    crt_busi_date = DecimalFloatField(column_name='CRT_BUSI_DATE', null=True)
    crt_by = CharField(column_name='CRT_BY', null=True)
    crt_date = DateTimeField(column_name='CRT_DATE', null=True)
    curpar = DecimalFloatField(column_name='CURPAR', null=True)
    dc_business_date = DecimalFloatField(column_name='DC_BUSINESS_DATE', null=True)
    dc_collect_date = DateTimeField(column_name='DC_COLLECT_DATE', null=True)
    dc_program_id = DecimalFloatField(column_name='DC_PROGRAM_ID', null=True)
    dc_server_id = DecimalFloatField(column_name='DC_SERVER_ID', null=True)
    delistingdate = DateTimeField(column_name='DELISTINGDATE', null=True)
    duration = DecimalFloatField(column_name='DURATION', null=True)
    enddate = DateTimeField(column_name='ENDDATE', null=True)
    enterpriseproperties = CharField(column_name='ENTERPRISEPROPERTIES', null=True)
    etl_src_table = TextField(column_name='ETL_SRC_TABLE', null=True)
    evalutedyield = DecimalFloatField(column_name='EVALUTEDYIELD', null=True)
    exchangecode = DecimalFloatField(column_name='EXCHANGECODE', null=True)
    exchangename = CharField(column_name='EXCHANGENAME', null=True)
    fullprice_cics = DecimalFloatField(column_name='FULLPRICE_CICS', null=True)
    fullvaluationfinal = DecimalFloatField(column_name='FULLVALUATIONFINAL', null=True)
    guarcomcode = DecimalFloatField(column_name='GUARCOMCODE', null=True)
    guarmethod = DecimalFloatField(column_name='GUARMETHOD', null=True)
    guarmethoddesc = CharField(column_name='GUARMETHODDESC', null=True)
    guarname = CharField(column_name='GUARNAME', null=True)
    guarpubdate = DateTimeField(column_name='GUARPUBDATE', null=True)
    guarratio = DecimalFloatField(column_name='GUARRATIO', null=True)
    id = BigAutoField(column_name='ID')
    impratingcode = CharField(column_name='IMPRATINGCODE', null=True)
    impratingdate = DateTimeField(column_name='IMPRATINGDATE', null=True)
    inducodei = CharField(column_name='INDUCODEI', null=True)
    inducodeii = CharField(column_name='INDUCODEII', null=True)
    inducodeiii = CharField(column_name='INDUCODEIII', null=True)
    inducodeiv = CharField(column_name='INDUCODEIV', null=True)
    indunamei = CharField(column_name='INDUNAMEI', null=True)
    indunameii = CharField(column_name='INDUNAMEII', null=True)
    indunameiii = CharField(column_name='INDUNAMEIII', null=True)
    indunameiv = CharField(column_name='INDUNAMEIV', null=True)
    isfirstrating = CharField(column_name='ISFIRSTRATING', null=True)
    isin = CharField(column_name='ISIN', null=True)
    issuer = CharField(column_name='ISSUER', null=True)
    issuesize = DecimalFloatField(column_name='ISSUESIZE', null=True)
    i_bond_rate = CharField(column_name='I_BOND_RATE', null=True)
    i_com_rate = CharField(column_name='I_COM_RATE', null=True)
    lastimpratingcode = CharField(column_name='LASTIMPRATINGCODE', null=True)
    lastrawcredit = CharField(column_name='LASTRAWCREDIT', null=True)
    last_creditrating = CharField(column_name='LAST_CREDITRATING', null=True)
    last_i_bond_rate = CharField(column_name='LAST_I_BOND_RATE', null=True)
    last_i_com_rate = CharField(column_name='LAST_I_COM_RATE', null=True)
    last_modf_busi_date = DecimalFloatField(column_name='LAST_MODF_BUSI_DATE', null=True)
    last_modf_by = CharField(column_name='LAST_MODF_BY', null=True)
    last_modf_date = DateTimeField(column_name='LAST_MODF_DATE', null=True)
    last_ratingcode = CharField(column_name='LAST_RATINGCODE', null=True)
    listingdate = DateTimeField(column_name='LISTINGDATE', null=True)
    modiduration = DecimalFloatField(column_name='MODIDURATION', null=True)
    netprice_cics = DecimalFloatField(column_name='NETPRICE_CICS', null=True)
    netvaluation = DecimalFloatField(column_name='NETVALUATION', null=True)
    parval = DecimalFloatField(column_name='PARVAL', null=True)
    period_id = DecimalFloatField(column_name='PERIOD_ID', null=True)
    provincecode = DecimalFloatField(column_name='PROVINCECODE', null=True)
    provincename = CharField(column_name='PROVINCENAME', null=True)
    raisetype = CharField(column_name='RAISETYPE', null=True)
    ratingagency = CharField(column_name='RATINGAGENCY', null=True)
    ratingagencycode = DecimalFloatField(column_name='RATINGAGENCYCODE', null=True)
    ratingcode = CharField(column_name='RATINGCODE', null=True)
    ratingdate = DateTimeField(column_name='RATINGDATE', null=True)
    ratingdirection = DecimalFloatField(column_name='RATINGDIRECTION', null=True)
    ratingdirectiondesc = CharField(column_name='RATINGDIRECTIONDESC', null=True)
    ratingforecastcode = DecimalFloatField(column_name='RATINGFORECASTCODE', null=True)
    ratingforecastdesc = CharField(column_name='RATINGFORECASTDESC', null=True)
    rawcredit = CharField(column_name='RAWCREDIT', null=True)
    rawradjustdir = DecimalFloatField(column_name='RAWRADJUSTDIR', null=True)
    realfullprice = DecimalFloatField(column_name='REALFULLPRICE', null=True)
    realyield = DecimalFloatField(column_name='REALYIELD', null=True)
    remainprincipal = DecimalFloatField(column_name='REMAINPRINCIPAL', null=True)
    secuabbr = CharField(column_name='SECUABBR', null=True)
    secucategory = CharField(column_name='SECUCATEGORY', null=True)
    secucategorycodei = DecimalFloatField(column_name='SECUCATEGORYCODEI', null=True)
    secucategorycodeii = DecimalFloatField(column_name='SECUCATEGORYCODEII', index=True, null=True)
    secucategorynamei = CharField(column_name='SECUCATEGORYNAMEI', null=True)
    secucode = BigIntegerField(column_name='SECUCODE', index=True)
    spread = DecimalFloatField(column_name='SPREAD', null=True)
    termtomaturity = DecimalFloatField(column_name='TERMTOMATURITY', null=True)
    tradableamount = DecimalFloatField(column_name='TRADABLEAMOUNT', null=True)
    tradingcode = CharField(column_name='TRADINGCODE', index=True, null=True)
    abs_comcode = CharField(null=True)
    abs_comname = CharField(null=True)
    absclient_code = CharField(null=True)
    absclient_name = CharField(null=True)
    bnd_belongs = CharField(null=True)
    bnd_cred_intr_category = CharField(null=True)
    bnd_expirydate = DateField(null=True)
    bnd_indu_invst_category = CharField(null=True)
    bnd_investment_scope = CharField(null=True)
    bnd_pubdate = DateField(null=True)
    bnd_ratingcode = CharField(null=True)
    c_rating_status = CharField(null=True)
    cams_firstcode = DecimalFloatField(null=True)
    cams_firstname = CharField(null=True)
    cams_secondcode = DecimalFloatField(null=True)
    cams_secondname = CharField(null=True)
    com_belongs = CharField(null=True)
    com_deadline_time = DateField(null=True)
    com_expirydate = DateField(null=True)
    com_investment_scope = CharField(null=True)
    com_pubdate = DateField(null=True)
    coup_face_intr = DecimalFloatField(null=True)
    creditrating_main = CharField(null=True)
    creditratingdate_main = DateField(null=True)
    creditview_main = DecimalFloatField(null=True)
    creditviewdesc_main = CharField(null=True)
    exerdate = DateTimeField(constraints=[SQL("DEFAULT current_timestamp()")])
    exerduration = DecimalFloatField(null=True)
    guar_creditview = CharField(null=True)
    guar_ratingagency = CharField(null=True)
    guar_ratingcode = CharField(null=True)
    guar_ratingdate = DateTimeField(null=True)
    guar_ratingdirection = CharField(null=True)
    guarantor = CharField(null=True)
    guarantor_code = DecimalFloatField(null=True)
    i_attention_details = CharField(null=True)
    i_attention_title = CharField(null=True)
    i_bond_is_valid = CharField(null=True)
    i_bond_rating_status = CharField(null=True)
    i_com_is_valid = CharField(null=True)
    i_com_rating_status = CharField(null=True)
    is_dbtr = CharField(null=True)
    isfchoise = CharField(null=True)
    ispubissue = CharField(null=True)
    issue_bndrating = CharField(null=True)
    issue_comrating = CharField(null=True)
    issue_creditview = CharField(null=True)
    issue_guarating = CharField(null=True)
    issue_ratingagency = CharField(null=True)
    mkt_code = CharField(null=True)
    next_indv_intp_date = DateField(null=True)
    paresecucode = CharField(null=True)
    rate_code_compr = CharField(null=True)
    ratingagency_main = CharField(null=True)
    ratingagencycode_main = DecimalFloatField(null=True)
    ratingcode_main = CharField(null=True)
    ratingdate_main = DateField(null=True)
    ratingdirection_main = DecimalFloatField(null=True)
    ratingdirectiondesc_main = CharField(null=True)
    ratingforecastcode_main = DecimalFloatField(null=True)
    ratingforecastdesc_main = CharField(null=True)
    sk_f_secu = CharField(index=True, null=True)
    zz_accruedinterest = DecimalFloatField(null=True)
    zz_convexity = DecimalFloatField(null=True)
    zz_eclearprice = DecimalFloatField(null=True)
    zz_econvexity = DecimalFloatField(null=True)
    zz_edirtyprice = DecimalFloatField(null=True)
    zz_edurationmod = DecimalFloatField(null=True)
    zz_eyield = DecimalFloatField(null=True)
    zz_fullprice = DecimalFloatField(null=True)
    zz_modiduration = DecimalFloatField(null=True)
    zz_netprice = DecimalFloatField(null=True)
    zz_rdirection = DecimalFloatField(null=True)
    zz_yield = DecimalFloatField(null=True)

    class Meta:
        table_name = 'in_inf_idp_bnd_info_di'
        indexes = (
            (('comcode', 'categorynamei'), False),
            (('tradingcode', 'exchangecode'), False),
        )

class S02BndIbsettlementquote(BaseModel):
    avgperturnover = FloatField(null=True)
    parvalvol = FloatField(null=True)
    secucode = BigIntegerField(index=True)
    tradingcode = CharField(null=True)
    tradingday = DateTimeField()
    turnoverdeals = FloatField(null=True)

    class Meta:
        table_name = 's02_bnd_ibsettlementquote'
        indexes = (
            (('secucode', 'tradingday'), False),
        )
        primary_key = False

class S07BndBasicinfoRealtime(BaseModel):
    abslevel = CharField(column_name='ABSLEVEL', null=True)
    abslevelratio = DecimalFloatField(column_name='ABSLEVELRATIO', null=True)
    absoriginator = CharField(column_name='ABSORIGINATOR', null=True)
    accrueddate = DateField(column_name='ACCRUEDDATE', null=True)
    adinterestmethod = DecimalFloatField(column_name='ADINTERESTMETHOD', null=True)
    adjustingmethod = CharField(column_name='ADJUSTINGMETHOD', null=True)
    baseasset = CharField(column_name='BASEASSET', null=True)
    bcode = CharField(column_name='BCODE', null=True)
    bidmode = DecimalFloatField(column_name='BIDMODE', null=True)
    bidobject = DecimalFloatField(column_name='BIDOBJECT', null=True)
    bndtypecodewindcnpti = CharField(column_name='BNDTYPECODEWINDCNPTI', null=True)
    bndtypecodewindcnptii = CharField(column_name='BNDTYPECODEWINDCNPTII', null=True)
    bndtypecodewindi = CharField(column_name='BNDTYPECODEWINDI', null=True)
    bndtypecodewindii = CharField(column_name='BNDTYPECODEWINDII', null=True)
    bndtypenamewindcnpti = TextField(column_name='BNDTYPENAMEWINDCNPTI', null=True)
    bndtypenamewindcnptii = TextField(column_name='BNDTYPENAMEWINDCNPTII', null=True)
    bndtypenamewindi = CharField(column_name='BNDTYPENAMEWINDI', null=True)
    bndtypenamewindii = CharField(column_name='BNDTYPENAMEWINDII', null=True)
    bndtypenewcodei = CharField(column_name='BNDTYPENEWCODEI', null=True)
    bndtypenewcodeii = CharField(column_name='BNDTYPENEWCODEII', null=True)
    bndtypenewnamei = CharField(column_name='BNDTYPENEWNAMEI', null=True)
    bndtypenewnameii = CharField(column_name='BNDTYPENEWNAMEII', null=True)
    bndyear = CharField(column_name='BNDYEAR', null=True)
    bndyearbatch = CharField(column_name='BNDYEARBATCH', null=True)
    boardcode = DecimalFloatField(column_name='BOARDCODE', null=True)
    boardname = CharField(column_name='BOARDNAME', null=True)
    bondform = CharField(column_name='BONDFORM', null=True)
    bondformcode = DecimalFloatField(column_name='BONDFORMCODE', null=True)
    bondmaincode = DecimalFloatField(column_name='BONDMAINCODE', null=True)
    bondmaturity = DecimalFloatField(column_name='BONDMATURITY', null=True)
    bondmaturityday = DecimalFloatField(column_name='BONDMATURITYDAY', null=True)
    bondrating = DecimalFloatField(column_name='BONDRATING', null=True)
    bondratingagency = CharField(column_name='BONDRATINGAGENCY', null=True)
    bondratingdate = DateField(column_name='BONDRATINGDATE', null=True)
    bondratingnew = CharField(column_name='BONDRATINGNEW', null=True)
    bondtype = DecimalFloatField(column_name='BONDTYPE', null=True)
    bondtypecode = DecimalFloatField(column_name='BONDTYPECODE', null=True)
    bondtypename = CharField(column_name='BONDTYPENAME', null=True)
    callclause = TextField(column_name='CALLCLAUSE', null=True)
    calldate = DateField(column_name='CALLDATE', null=True)
    callprice = DecimalFloatField(column_name='CALLPRICE', null=True)
    callprotection = DecimalFloatField(column_name='CALLPROTECTION', null=True)
    chiname = CharField(column_name='CHINAME', null=True)
    chinameabbr = CharField(column_name='CHINAMEABBR', null=True)
    chispelling = CharField(column_name='CHISPELLING', null=True)
    claremode = CharField(column_name='CLAREMODE', null=True)
    comcode = DecimalFloatField(column_name='COMCODE', null=True)
    compensationrate = DecimalFloatField(column_name='COMPENSATIONRATE', null=True)
    convertabbr = CharField(column_name='CONVERTABBR', null=True)
    convertcode = CharField(column_name='CONVERTCODE', null=True)
    convertenddate = DateField(column_name='CONVERTENDDATE', null=True)
    convertrate = DecimalFloatField(column_name='CONVERTRATE', null=True)
    convertstartdate = DateField(column_name='CONVERTSTARTDATE', null=True)
    convertstopdate = DateField(column_name='CONVERTSTOPDATE', null=True)
    couponrate = DecimalFloatField(column_name='COUPONRATE', null=True)
    coupontypenew = CharField(column_name='COUPONTYPENEW', null=True)
    creditcisc = CharField(column_name='CREDITCISC', null=True)
    creditcnbd = CharField(column_name='CREDITCNBD', null=True)
    currencycode = DecimalFloatField(column_name='CURRENCYCODE', null=True)
    currentamt = DecimalFloatField(column_name='CURRENTAMT', null=True)
    customcode = CharField(column_name='CUSTOMCODE', null=True)
    debenture = DecimalFloatField(column_name='DEBENTURE', null=True)
    delistdate = DateField(column_name='DELISTDATE', null=True)
    delistingdate = DateField(column_name='DELISTINGDATE', null=True)
    enddate = DateField(column_name='ENDDATE', null=True)
    engname = CharField(column_name='ENGNAME', null=True)
    engnameabbr = CharField(column_name='ENGNAMEABBR', null=True)
    entrytime = DateField(column_name='ENTRYTIME', null=True)
    exchangecode = DecimalFloatField(column_name='EXCHANGECODE', null=True)
    exchangename = CharField(column_name='EXCHANGENAME', null=True)
    exertype = CharField(column_name='EXERTYPE', null=True)
    expanyield = CharField(column_name='EXPANYIELD', null=True)
    expectenddate = DateField(column_name='EXPECTENDDATE', null=True)
    externalcredit = DecimalFloatField(column_name='EXTERNALCREDIT', null=True)
    figinterestmethod = DecimalFloatField(column_name='FIGINTERESTMETHOD', null=True)
    firbondrating = CharField(column_name='FIRBONDRATING', null=True)
    firbondratingagency = CharField(column_name='FIRBONDRATINGAGENCY', null=True)
    firbondratingdate = DateField(column_name='FIRBONDRATINGDATE', null=True)
    firissuerrating = CharField(column_name='FIRISSUERRATING', null=True)
    firissuerratingagency = CharField(column_name='FIRISSUERRATINGAGENCY', null=True)
    firissuerratingdate = DateField(column_name='FIRISSUERRATINGDATE', null=True)
    furissutimes = DecimalFloatField(column_name='FURISSUTIMES', null=True)
    gatherbill = DecimalFloatField(column_name='GATHERBILL', null=True)
    groundtime = DateField(column_name='GROUNDTIME', null=True)
    guarantor = CharField(column_name='GUARANTOR', null=True)
    guartype = CharField(column_name='GUARTYPE', null=True)
    id = DecimalFloatField(column_name='ID', primary_key=True)
    indunamecsrci = CharField(column_name='INDUNAMECSRCI', null=True)
    indunamecsrcii = CharField(column_name='INDUNAMECSRCII', null=True)
    indunameswi = CharField(column_name='INDUNAMESWI', null=True)
    indunameswii = CharField(column_name='INDUNAMESWII', null=True)
    indunameswiii = CharField(column_name='INDUNAMESWIII', null=True)
    interestbenchcode = CharField(column_name='INTERESTBENCHCODE', null=True)
    interestformula = DecimalFloatField(column_name='INTERESTFORMULA', null=True)
    interestmethod = DecimalFloatField(column_name='INTERESTMETHOD', null=True)
    interestratedesc = TextField(column_name='INTERESTRATEDESC', null=True)
    interestratefloor = DecimalFloatField(column_name='INTERESTRATEFLOOR', null=True)
    interestterm = TextField(column_name='INTERESTTERM', null=True)
    internalcredit = DecimalFloatField(column_name='INTERNALCREDIT', null=True)
    ischange = CharField(column_name='ISCHANGE', null=True)
    iscityinvert = DecimalFloatField(column_name='ISCITYINVERT', null=True)
    iscorssmarket = DecimalFloatField(column_name='ISCORSSMARKET', null=True)
    iscvt = DecimalFloatField(column_name='ISCVT', null=True)
    isexpire = DecimalFloatField(column_name='ISEXPIRE', null=True)
    isfailure = DecimalFloatField(column_name='ISFAILURE', null=True)
    isfchoise = DecimalFloatField(column_name='ISFCHOISE', null=True)
    isfloating = DecimalFloatField(column_name='ISFLOATING', null=True)
    isguaranteed = CharField(column_name='ISGUARANTEED', null=True)
    isin = CharField(column_name='ISIN', null=True)
    ispayadvanced = DecimalFloatField(column_name='ISPAYADVANCED', null=True)
    isproc = DecimalFloatField(column_name='ISPROC', null=True)
    isredemption = DecimalFloatField(column_name='ISREDEMPTION', null=True)
    issorgtype = CharField(column_name='ISSORGTYPE', null=True)
    isstrips = CharField(column_name='ISSTRIPS', null=True)
    issueamtact = DecimalFloatField(column_name='ISSUEAMTACT', null=True)
    issueamtplan = DecimalFloatField(column_name='ISSUEAMTPLAN', null=True)
    issuecouponrate = DecimalFloatField(column_name='ISSUECOUPONRATE', null=True)
    issueenddate = DateField(column_name='ISSUEENDDATE', null=True)
    issuefee = DecimalFloatField(column_name='ISSUEFEE', null=True)
    issueobject = CharField(column_name='ISSUEOBJECT', null=True)
    issueprice = DecimalFloatField(column_name='ISSUEPRICE', null=True)
    issuer = CharField(column_name='ISSUER', null=True)
    issuerbusitype = CharField(column_name='ISSUERBUSITYPE', null=True)
    issuercode = DecimalFloatField(column_name='ISSUERCODE', null=True)
    issuerefytm = DecimalFloatField(column_name='ISSUEREFYTM', null=True)
    issuereportdate = DateField(column_name='ISSUEREPORTDATE', null=True)
    issuermain = CharField(column_name='ISSUERMAIN', null=True)
    issuerrating = CharField(column_name='ISSUERRATING', null=True)
    issuerratingagency = CharField(column_name='ISSUERRATINGAGENCY', null=True)
    issuerratingdate = DateField(column_name='ISSUERRATINGDATE', null=True)
    issuesize = DecimalFloatField(column_name='ISSUESIZE', null=True)
    issuestartdate = DateField(column_name='ISSUESTARTDATE', null=True)
    issuevol = DecimalFloatField(column_name='ISSUEVOL', null=True)
    isswap = DecimalFloatField(column_name='ISSWAP', null=True)
    isvalid = DecimalFloatField(column_name='ISVALID', null=True)
    iswarrant = DecimalFloatField(column_name='ISWARRANT', null=True)
    leadunderwriter = CharField(column_name='LEADUNDERWRITER', null=True)
    listanndate = DateField(column_name='LISTANNDATE', null=True)
    listingdate = DateField(column_name='LISTINGDATE', null=True)
    listingstatecode = DecimalFloatField(column_name='LISTINGSTATECODE', null=True)
    mixcapitalbond = DecimalFloatField(column_name='MIXCAPITALBOND', null=True)
    mtn = DecimalFloatField(column_name='MTN', null=True)
    newsparval = DecimalFloatField(column_name='NEWSPARVAL', null=True)
    optioncode = CharField(column_name='OPTIONCODE', null=True)
    orirightscomcode = CharField(column_name='ORIRIGHTSCOMCODE', null=True)
    orirightscomname = TextField(column_name='ORIRIGHTSCOMNAME', null=True)
    parval = DecimalFloatField(column_name='PARVAL', null=True)
    paymentdate = DateField(column_name='PAYMENTDATE', null=True)
    paymentfrequency = DecimalFloatField(column_name='PAYMENTFREQUENCY', null=True)
    paymentmethod = DecimalFloatField(column_name='PAYMENTMETHOD', null=True)
    paymentmethodstat = TextField(column_name='PAYMENTMETHODSTAT', null=True)
    payofforder = CharField(column_name='PAYOFFORDER', null=True)
    progmode = CharField(column_name='PROGMODE', null=True)
    prograte = DecimalFloatField(column_name='PROGRATE', null=True)
    pubpaymentdate = DateField(column_name='PUBPAYMENTDATE', null=True)
    puttdate = DateField(column_name='PUTTDATE', null=True)
    puttprice = DecimalFloatField(column_name='PUTTPRICE', null=True)
    raisemode = CharField(column_name='RAISEMODE', null=True)
    recordid = CharField(column_name='RECORDID', null=True)
    recordidnew = CharField(column_name='RECORDIDNEW', null=True)
    redemptiondate = DateField(column_name='REDEMPTIONDATE', null=True)
    redemptionfee = DecimalFloatField(column_name='REDEMPTIONFEE', null=True)
    refbasecode = DecimalFloatField(column_name='REFBASECODE', null=True)
    refrate = DecimalFloatField(column_name='REFRATE', null=True)
    refspread = DecimalFloatField(column_name='REFSPREAD', null=True)
    registerfilenumber = TextField(column_name='REGISTERFILENUMBER', null=True)
    registerfiletype = DecimalFloatField(column_name='REGISTERFILETYPE', null=True)
    registerfil_edecimal = TextField(column_name='REGISTERFILEdecimal', null=True)
    registerhostplace = CharField(column_name='REGISTERHOSTPLACE', null=True)
    reguarantor = CharField(column_name='REGUARANTOR', null=True)
    remark = TextField(column_name='REMARK', null=True)
    resalematurity = CharField(column_name='RESALEMATURITY', null=True)
    resourceid = CharField(column_name='RESOURCEID', null=True)
    rightstatus = CharField(column_name='RIGHTSTATUS', null=True)
    secuabbr = CharField(column_name='SECUABBR', null=True)
    secucategory = CharField(column_name='SECUCATEGORY', null=True)
    secucategorycodei = DecimalFloatField(column_name='SECUCATEGORYCODEI', null=True)
    secucategorycodeii = DecimalFloatField(column_name='SECUCATEGORYCODEII', null=True)
    secucode = DecimalFloatField(column_name='SECUCODE', null=True)
    shortfinancebond = DecimalFloatField(column_name='SHORTFINANCEBOND', null=True)
    shsettleway = DecimalFloatField(column_name='SHSETTLEWAY', null=True)
    sponsor = CharField(column_name='SPONSOR', null=True)
    sramanadate = DateField(column_name='SRAMANADATE', null=True)
    subdebt = DecimalFloatField(column_name='SUBDEBT', null=True)
    subfixdebt = DecimalFloatField(column_name='SUBFIXDEBT', null=True)
    totalissuesize = DecimalFloatField(column_name='TOTALISSUESIZE', null=True)
    tradetype = DecimalFloatField(column_name='TRADETYPE', null=True)
    tradingcode = CharField(column_name='TRADINGCODE', null=True)
    updateid = DecimalFloatField(column_name='UPDATEID', null=True)
    updatetime = DateField(column_name='UPDATETIME', null=True)
    viceunderwriter = TextField(column_name='VICEUNDERWRITER', null=True)
    windcode = CharField(column_name='WINDCODE', null=True)
    yearpaymentdate = CharField(column_name='YEARPAYMENTDATE', null=True)

    class Meta:
        table_name = 's07_bnd_basicinfo_realtime'

class S07BndCbondcf(BaseModel):
    carrydate = DateTimeField(null=True)
    couponrate = DecimalFloatField(null=True)
    enddate = DateTimeField(null=True)
    entrytime = DateField()
    groundtime = DateField()
    id = DecimalFloatField(primary_key=True)
    isvalid = DecimalFloatField()
    paymentdate = DateTimeField(null=True)
    paymentinterest = DecimalFloatField(null=True)
    paymentparvalue = DecimalFloatField(null=True)
    paymentsum = DecimalFloatField(null=True)
    recordid = CharField(null=True)
    resourceid = CharField()
    secucode = DecimalFloatField(null=True)
    tradingcode = CharField(null=True)
    updateid = DecimalFloatField()
    updatetime = DateField()
    windcode = CharField(null=True)

    class Meta:
        table_name = 's07_bnd_cbondcf'
        indexes = (
            (('tradingcode', 'enddate'), False),
            (('windcode', 'enddate'), False),
        )

class S07BndValuation(BaseModel):
    absoluteliquidity = DecimalFloatField(null=True)
    accruedinterest = DecimalFloatField(null=True)
    accruedinterestfinal = DecimalFloatField(null=True)
    basispointval = DecimalFloatField(null=True)
    convexity = DecimalFloatField(null=True)
    couponrateafterex = DecimalFloatField(null=True)
    curvecode = DecimalFloatField(null=True)
    curvename = CharField(null=True)
    datasource = DecimalFloatField(null=True)
    duration = DecimalFloatField(null=True)
    entrytime = DateTimeField(null=True)
    evalutedspreadyield = DecimalFloatField(null=True)
    evalutedyield = DecimalFloatField(null=True)
    exchangecode = DecimalFloatField(null=True)
    fullvaluation = DecimalFloatField(null=True)
    fullvaluationfinal = DecimalFloatField(null=True)
    groundtime = DateTimeField(null=True)
    id = DecimalFloatField(null=True)
    implicationratingcode = CharField(null=True)
    modiduration = DecimalFloatField(null=True)
    netvaluation = DecimalFloatField(null=True)
    pctofrank = DecimalFloatField(null=True)
    realbasispointval = DecimalFloatField(null=True)
    realconvexity = DecimalFloatField(null=True)
    realfullprice = DecimalFloatField(null=True)
    realmodiduration = DecimalFloatField(null=True)
    realrefrateconvexity = DecimalFloatField(null=True)
    realrefrateduration = DecimalFloatField(null=True)
    realspreadconvexity = DecimalFloatField(null=True)
    realspreadduration = DecimalFloatField(null=True)
    realspreadyield = DecimalFloatField(null=True)
    realyield = DecimalFloatField(null=True)
    recordid = CharField(null=True)
    refrateconvexity = DecimalFloatField(null=True)
    refrateduration = DecimalFloatField(null=True)
    relativeliquidity = DecimalFloatField(null=True)
    relativeliquidityval = DecimalFloatField(null=True)
    remainprincipal = DecimalFloatField(null=True)
    resourceid = CharField(null=True)
    secuabbr = CharField(null=True)
    secucode = DecimalFloatField(index=True)
    spread = DecimalFloatField(null=True)
    spreadconvexity = DecimalFloatField(null=True)
    spreadduration = DecimalFloatField(null=True)
    spreadyield = DecimalFloatField(null=True)
    termtomaturity = DecimalFloatField(null=True)
    tradableamount = DecimalFloatField(null=True)
    tradingcode = CharField(null=True)
    tradingday = DateTimeField(index=True)
    updateid = DecimalFloatField(null=True)
    updatetime = DateTimeField(null=True)
    valuationmethod = DecimalFloatField(null=True)

    class Meta:
        table_name = 's07_bnd_valuation'
        indexes = (
            (('secucode', 'tradingday', 'datasource'), False),
        )
        primary_key = False

